package com.basker.pisces.service.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.basker.pisces.service.context.LoginContextInterceptor;

/**
 * 默认的WebMvcConfigurer，设置和springmvc相关的组件
 *
 * @author hangwen
 */
@Configuration
public class DefaultWebMvcConfigurer implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginContextInterceptor());
    }

    @Bean
    public LoginContextInterceptor loginContextInterceptor() {
        return new LoginContextInterceptor();
    }

}
